#include "aboutdialog.h"
#include "globalsettings.h"
#include <QKeyEvent>
#include <QLabel>
#include <QPushButton>
#include <QtDebug>
#include <QVBoxLayout>

AboutDialog::AboutDialog(QWidget* parent) : QDialog(parent)
{
    setWindowTitle(tr("About"));

    QVBoxLayout* main_layout = new QVBoxLayout(this);
    main_layout->setContentsMargins(20, 20, 20, 20);
    main_layout->setSpacing(2);

    QFrame* icon = new QFrame(this);
    icon->setObjectName("icon");
    main_layout->addWidget(icon, 0);
    main_layout->addSpacing(15);

    QLabel* name_label = new QLabel(tr("YingCe ") + GlobalSettings::currentVersion(), this);
    name_label->setObjectName("name");
    main_layout->addWidget(name_label, 0, Qt::AlignLeft);

    QLabel* copyright_label = new QLabel(tr("Copyright"), this);
    copyright_label->setObjectName("copyright");
    main_layout->addWidget(copyright_label, 0, Qt::AlignLeft);
    main_layout->addSpacing(10);

    QLabel* thanks_label = new QLabel(tr("thanks"), this);
    thanks_label->setObjectName("thanks");
    main_layout->addWidget(thanks_label, 0, Qt::AlignLeft);

    QHBoxLayout* btn_layout = new QHBoxLayout;
    btn_layout->setContentsMargins(0, 0, 0, 0);
    btn_layout->addStretch(1);

    QPushButton* close_button = new QPushButton(tr("Close"), this);
    close_button->setObjectName("normal");
    btn_layout->addWidget(close_button);

    main_layout->addStretch(1);
    main_layout->addLayout(btn_layout);

    connect(close_button, &QPushButton::clicked, this, &QDialog::close);
}
